package com.powernode.controller;

import com.powernode.domain.Product;
import com.powernode.model.R;
import com.powernode.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 产品接口管理
 */
@RestController
@RequestMapping("/api/product")
public class ProductController {

    @Autowired
    private ProductService productService;

    /**
     * 查询所有产品列表
     * @return
     */
    @GetMapping("/list")
    public R<List<Product>> loadProductList() {
        List<Product> products = productService.queryProducts();
        return R.OK(products);
    }
}
